package com.wc.codeforces.模拟.Increase_Decrease_Copy;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @Author congge
 * @Date 2024/6/10 12:02
 * @description https://codeforces.com/problemset/problem/1976/B
 */
public class Main {
    static FastReader sc = new FastReader();
    static PrintWriter out = new PrintWriter(System.out);
    static int N = 200010, INF = 0x3f3f3f3f;
    static int[] a = new int[N], b = new int[N];
    static int n;

    public static void main(String[] args) {
        int T = sc.nextInt();
        while (T-- > 0) {
            n = sc.nextInt();
            for (int i = 1; i <= n; i++) a[i] = sc.nextInt();
            for (int i = 1; i <= n + 1; i++) b[i] = sc.nextInt();
            int last = b[n + 1], lastRes = INF;
            // last copy
            long res = 1;
            for (int i = 1; i <= n; i++) {
                res += Math.abs(a[i] - b[i]);
                if (Math.min(a[i], b[i]) <= last && Math.max(a[i], b[i]) >= last) {
                    lastRes = 0;
                }
                int l = Math.abs(a[i] - last), r = Math.abs(b[i] - last);
                lastRes = Math.min(lastRes, Math.min(l, r));
            }
            res += lastRes;
            out.println(res);
        }
        out.flush();
    }
}

class FastReader {
    StringTokenizer st;
    BufferedReader br;

    FastReader() {
        br = new BufferedReader(new InputStreamReader(System.in));
    }

    String next() {
        while (st == null || !st.hasMoreElements()) {
            try {
                st = new StringTokenizer(br.readLine());
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return st.nextToken();
    }

    int nextInt() {
        return Integer.parseInt(next());
    }

    String nextLine() {
        String s = "";
        try {
            s = br.readLine();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return s;
    }

    long nextLong() {
        return Long.parseLong(next());
    }

    double nextDouble() {
        return Double.parseDouble(next());
    }

    // 是否由下一个
    boolean hasNext() {
        while (st == null || !st.hasMoreTokens()) {
            try {
                String line = br.readLine();
                if (line == null)
                    return false;
                st = new StringTokenizer(line);
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        return true;
    }
}
